package com.example.testnews.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import androidx.appcompat.app.AppCompatActivity;

import com.example.testnews.R;
import com.example.testnews.bean.News;

import java.util.List;

public class CollectNewsActivity extends AppCompatActivity {
    private WebView mCollectWebView;
    private String url2;
    private List<News> collectNewsList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_collect_news);
        mCollectWebView = findViewById(R.id.collect_webview);

        Intent intent = getIntent();
        url2 = intent.getStringExtra("collect_news");

        WebSettings webSettings = mCollectWebView.getSettings();
        mCollectWebView.setWebViewClient(new WebViewClient());
        webSettings.setJavaScriptEnabled(true);// 让WebView能够执行javaScript
        webSettings.setSupportZoom(true);// 支持缩放(适配到当前屏幕)
        webSettings.setUseWideViewPort(true); // 将图片调整到合适的大小
        //webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
        webSettings.setDisplayZoomControls(true);// 设置可以被显示的屏幕控制
        webSettings.setDefaultFontSize(12); // 设置默认字体大小
        webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);//设置 缓存模式
        webSettings.setDomStorageEnabled(true);// 开启 DOM storage API 功能
        Log.e("hhhhhhh","+++++++++++++++++++++++"+url2);
        mCollectWebView.loadUrl("https:" + url2);

    }
}